package com.atguigu.utils;

/**
 * @className: MysqlUtil
 * @author: LinCong
 * @description:
 * @date: 2023/1/31 20:53
 * @version: 1.0
 */
public class MysqlUtil {
    public static String getBaseDicLookUpDDL() {

        return "create table `base_dic`(   " +
                "`dic_code` string,   " +
                "`dic_name` string,   " +
                "`parent_code` string,   " +
                "`create_time` timestamp,   " +
                "`operate_time` timestamp,   " +
                "primary key(`dic_code`) not enforced   " +
                ")" + MysqlUtil.mysqlLookUpTableDDL("base_dic");
    }

    public static String mysqlLookUpTableDDL(String tableName) {

        String ddl = "WITH (   " +
                "'connector' = 'jdbc',   " +
                "'url' = 'jdbc:mysql://hadoop3-02:3306/gmall',   " +
                "'table-name' = '" + tableName + "',   " +
                "'lookup.cache.max-rows' = '10',   " +
                "'lookup.cache.ttl' = '1 hour',   " +
                "'username' = 'root',   " +
                "'password' = '000000',   " +
                "'driver' = 'com.mysql.cj.jdbc.Driver'   " +
                ")";
        return ddl;
    }
}
